package cn.linlane.entity.sys;

import cn.linlane.entity.base.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.util.List;

/**
 * @author cheng
 * @date 2018-06-27 10:24
 * 门店信息
 */
@Entity
@Getter
@Setter
@Table(name = "sys_depart")
@Where(clause = " is_delete = false")
public class SysDepart extends BaseEntity {

    @ApiModelProperty(value = "城市")
    private String city;

    @Column(name = "store_name")
    @ApiModelProperty(value = "部门名称")
    private String storeName;

    @Column(name = "store_code")
    @ApiModelProperty(value = "部门编码")
    private String storeCode;

    @Column(name = "parent_id")
    @ApiModelProperty(value = "父ID")
    private Integer parentId;

    @Column(name = "is_enabled")
    @ApiModelProperty(value = "false: 禁用 true: 可用")
    private boolean isEnabled = true;

    @Column(name = "store_enable")
    @ApiModelProperty(value = "库存实体是否禁用 false：不禁用，true：禁用")
    private Boolean storeEnable = false;

    @Column(name = "depart_type")
    @Enumerated(EnumType.STRING)
    @ApiModelProperty(value = "用户类型: STORE 门店，BIGREGION 大区， AREA 地区")
    private DepartType departType;

    @Transient
    private List<SysDepart> sysDeparts;

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + id;
        result = prime * result + ((storeCode == null) ? 0 : storeCode.hashCode());
        return result;
    }
}
